import React, { Component } from 'react';
import './MySecKill.scss'
import zdm1 from '../imgs/zdm_01.jpg'
import zdm2 from '../imgs/zdm_02.jpg'
import zdm3 from '../imgs/zdm_03.jpg'
import zdm4 from '../imgs/zdm_04.jpg'
import zdm5 from '../imgs/zdm_05.jpg'
import zdm6 from '../imgs/zdm_05.jpg'

import { index_goodlist } from '../utils/api';

class MySecKill extends Component {
   constructor(props){
    super(props)
      this.state={//定义组件状态
       arr:[  ]
      }

   }
  componentDidMount(){
    index_goodlist().then((res)=>{
      console.log(res.data);
      this.setState(this.state.arr=res.data.list)
      console.log("666"+this.state.arr);
    })
  }
    render() {
        return (
            <div className='myseckill'>
                {/* <p>今日值得买<span>00</span>:<span>40</span>:<span>10</span>后结束
                 MODE＞
                </p> */}
                
              {               
                // 列表渲染,使用js中的map函数
            
                this.state.arr.map((item)=>{
                  return(
                   <div className='list_1'>
                        

                              <img src={item.pic} alt="" />
                              <p className='p1'>{item.name}</p>
                              <p className='p2'>原价￥<span>{item.brand}</span></p>
                              <p>抢购价￥<span className='c1'>{item.price1}</span></p>
                       
                   </div>
                  )

                })
               }
            </div>
        );
    }
}

export default MySecKill;